import org.hibernate.Session;
import org.hibernate.SessionFactory;


public class Main {
	public static void main(String[] args) {
		 Session session = null;
		 SessionFactory factory = null;
			try{
		        factory = HibernateUtil.getSessionFactory();
		       
		        session = factory.openSession();
		        
		        /* test for university
		        University un=null;		        
		        un=(University)session.get(University.class, new Integer(1));
		        System.out.println(un.getCity());
		        */
		        
		        /* test for faculty
		        Faculty f=null;
		        f=(Faculty)session.get(Faculty.class, 1);
		        System.out.println(f.getName());
		         */
		        
				/*test for professor
			        Professor prof=null;
			        prof=(Professor)session.get(Professor.class, 5);
			        System.out.println(prof.getUniversity().getName());
			    */  
		        
				/*test for user
			        User us=null;
			        us=(User)session.get(User.class, 5);
			        System.out.println(us.getProfessor());
			    */  
		        
		        /*test for Subject
		        Subject sb=null;
		        sb=(Subject)session.get(Subject.class, 1);
		        System.out.println(sb.getName());
		        */
		        
		     /*   test for Exam		        
		        Exam ex=null;
		        ex=(Exam)session.get(Exam.class, 1);
		        System.out.println(ex.getSubject().getName());
		       */
		        
		     /*   test for Material	
		        Material m=null;
		        m=(Material)session.get(Material.class, 1);
		        System.out.println(m.getExam().getId());
		     */
		   //   /*   test for Student	
		        Student st=null;
		        st=(Student)session.get(Student.class, 1);
		        System.out.println(st.getExam().get(0).getId()); 
		    //   */
		        
		        
		        
			}catch(Throwable e){
				
				e.printStackTrace();	
				
			} finally{
				
				if(session!=null) session.close();
				if(factory!=null) factory.close();
			
			}
					
	}
}
